import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {


    //路径之迷

    private static int[] col, row;//记录靶子
    private static int[][] id;//迷宫大小
    private static int n;
    private static int R, C;
    private static boolean flag = false;
    private static boolean[][] vis;
    private static List<Integer> ans = new ArrayList<>();
    private static final int[] dx = {1, -1, 0, 0};
    private static final int[] dy = {0, 0, 1, -1};

    public static void dfs(int x, int y) {
        //先判断终止条件
        //走出棋盘且箭的数量不能为负数
        if (R == 0 && C == 0 && x == n && y == n) {
            flag = true;
            return;
        }
        for (int i = 0; i < 4; i++) {
            int xx = x + dx[i];
            int yy = y + dy[i];
            if (xx < 1 || xx > n || yy < 1 || yy > n) {
                continue;
            }
            if (col[yy] > 0 && row[xx] > 0 && !vis[xx][yy]) {
                ans.add(id[xx][yy]);
                vis[xx][yy] = true;
                col[yy]--;
                row[xx]--;
                R--;
                C--;
                dfs(xx, yy);
                if (flag) {
                    return;
                }
                vis[xx][yy] = false;
                col[yy]++;
                row[xx]++;
                R++;
                C++;
                ans.remove(ans.size() - 1);
            }
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        col = new int[n + 2];
        row = new int[n + 2];
        for (int i = 1; i <= n; i++) {
            col[i] = scanner.nextInt();//输入行靶子上箭的数量
            C += col[i];
        }
        for (int i = 1; i <= n; i++) {
            row[i] = scanner.nextInt();//输入列靶子上箭的数量
            R += row[i];
        }
        id = new int[n + 2][n + 2];
        int cnt = 0;//记录迷宫编号
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                id[i][j] = cnt++;
            }
        }
        vis = new boolean[n + 2][n + 2];
        ans.add(id[1][1]);
        vis[1][1] = true;
        row[1]--;
        col[1]--;
        R--;
        C--;
        dfs(1, 1);
        for (int num : ans) {
            System.out.print(num + " ");
        }
        System.out.println();
    }
}
